<div class="row"
     data-ng-controller="GnSearchController">
  <div class="col-md-12">
    <span data-ng-controller="GnCSWSettingsController">
      <div class="panel panel-default">
        <div class="panel-heading">
          <span data-translate="">cswService</span>
          <div class="btn-toolbar">
            <button type="submit" class="btn btn-primary pull-right"
                    data-ng-click="saveSettings('#gn-settings')"
            ><span class="fa fa-save"></span> {{"save"|translate}}</button>
          </div>
        </div>


        <div class="panel-body">
          <form id="gn-settings">
            <div>
              <label>
                <input type="checkbox" name="system.csw.enable"
                      value="{{cswSettings['system/csw/enable']}}"
                      data-ng-model="cswSettings['system/csw/enable']"/>
                <span>{{'system/csw/enable' | translate}}</span>
              </label>
              <p class="help-block">{{'system/csw/enable-help' | translate}}</p>
            </div>

            <div data-ng-search-form=""
                 data-ng-show="cswSettings['system/csw/enable']"
                 data-ng-controller="GnCSWSearchServiceRecordController">
              <label for="serviceList">{{'system/csw/capabilityRecordUuid' | translate}}</label>

             <div class="input-group dropdown"
                   id="serviceList">
                <input class="form-control"
                        data-ng-model="cswSettings['system/csw/capabilityRecordUuid']"
                        name="system.csw.capabilityRecordUuid"/>
                <span class="input-group-addon">
                  {{cswServiceRecord.title || cswServiceRecord.defaultTitle}}
                </span>
                <div class="input-group-btn">
                  <button type="button" class="btn btn-default dropdown-toggle"
                          data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
                          data-ng-click="updateParams();triggerSearch();" type="text">
                    <i class="fa fa-search"/>
                    <span class="caret"></span>
                  </button>
                  <ul class="dropdown-menu dropdown-menu-right">
                    <li>
                      <input class="form-control"
                             onClick="window.event.stopPropagation()"
                             data-ng-change="updateParams();triggerSearch();" type="text"
                             data-toggle="dropdown"
                             data-ng-model="searchObj.any"
                             data-ng-model-options="{debounce: 200}"
                             placeholder="{{'search' | translate}}"/>
                    </li>
                    <li data-ng-repeat="md in searchResults.records">
                      <a href=""
                         data-ng-click="cswSettings['system/csw/capabilityRecordUuid'] = md.getUuid()">
                        {{md.title || md.defaultTitle}}
                      </a>
                    </li>
                  </ul>
                </div>
             </div>

              <p class="help-block">{{'system/csw/capabilityRecordUuid-help' | translate}}</p>
            </div>
            <div data-ng-show="cswSettings['system/csw/enable']">
              <label>
                <input type="checkbox" name="system.csw.metadataPublic"
                      value="{{cswSettings['system/csw/metadataPublic']}}"
                      data-ng-model="cswSettings['system/csw/metadataPublic']"/>
                <span>{{'system/csw/metadataPublic' | translate}}</span>
              </label>

              <p class="help-block">{{'system/csw/metadataPublic-help' | translate}}</p>
            </div>
            <div data-ng-show="cswSettings['system/csw/enable']">
              <label>
                <input type="checkbox" name="system.csw.transactionUpdateCreateXPath"
                      value="{{cswSettings['system/csw/transactionUpdateCreateXPath']}}"
                      data-ng-model="cswSettings['system/csw/transactionUpdateCreateXPath']"/>
                <span>{{'system/csw/transactionUpdateCreateXPath' | translate}}</span>
              </label>

              <p class="help-block">{{'system/csw/transactionUpdateCreateXPath-help' | translate}}</p>
            </div>
          </form>


          <div data-gn-need-help="administrator-guide/configuring-the-catalog/csw-configuration.html"></div>
        </div>
      </div>

      <div class="panel panel-default"
           data-ng-show="cswSettings['system/csw/enable']">
        <div class="panel-heading">
          <span data-translate="">customizeElementSet</span>
          <div class="btn-toolbar">
            <button type="submit" class="btn btn-primary pull-right"
                    data-ng-click="saveCSWElementSetName('#gn-csw-elementsetname')"
            ><span class="fa fa-save"></span> {{"save"|translate}}</button>
          </div>
        </div>
        <div class="panel-body">
          <form id="gn-csw-elementsetname" class="form-horizontal">
                  <input type="hidden" name="_csrf" value="{{csrf}}"/>
            <fieldset>
              <p class="help-block" data-translate="">customizeElementSetHelp</p>
              <div class="form-group" data-ng-repeat="e in cswElementSetName track by $index">
                <div class="col-lg-10">
                  <input type="text" name="xpath" placeholder="/xpath" class="form-control"
                        data-ng-model="e"/>
                </div>
                <label class="col-lg-2 control-label">
                  <i class="fa fa-times text-danger" data-ng-click="deleteElementSetName(e)"></i>
                </label>
              </div>
              <div class="btn-toolbar">
                <button type="submit" class="btn btn-default" data-ng-click="addCSWElementSetName()"
                ><span class="fa fa-plus"></span> {{"add"|translate}}</button>
              </div>
            </fieldset>
          </form>
        </div>
      </div>
    </span>
  </div>
</div>
